home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / taropyon / hewin / ccisrc / he386.cci < prev    next >
Text File  |  1993-11-30  |  3KB  |  113 lines

  1. /*************************************************************************
  2. *    "he386.cci"
  3. *************************************************************************/
  4.  
  5. char    *_he386p_ = "he386p.exp";
  6. /*    "i:/hc/guilib3/prg/mml"    */
  7. char    HE386_CCIPATH_KEY[16] = {'H','e','3','8','6','_','c','c','i','p','a','t','h','\0'};
  8. char    he386_ccipath[256] = {0};
  9. char    he386_option[256]  = {0};
  10.  
  11. int        he386_compile( char *pn )
  12. {
  13.     int        ret, drv;
  14.     char    tmp[256], fn[256];
  15.  
  16.     /* カレント変更    */
  17.     drv = toupper(pn[0]) - 'A';
  18.     FS_chdrv(drv);
  19.     FS_getDnamPath(tmp,pn);
  20.     FS_chdir(tmp);
  21.  
  22.     /* DTA 領域の設定    */
  23.     AplDtaInit();
  24.     if ( he386_ccipath[0] )
  25.         sprintf( tmp, "-cciPath %s", he386_ccipath);
  26.     else
  27.         tmp[0] = '\0';
  28.     AplDtaSetStr( "$MainArg", "%s %s %s %s", _he386p_, he386_option, tmp, pn );
  29.  
  30.     ret = AplPclExec( _he386p_, 0 );
  31.  
  32.     FS_getFnam(fn,pn);
  33.     FS_appendSnam( fn, fn, ".mid" );
  34.     if ( FS_isFileExist(fn) > 0 )
  35.         MID_playStart( fn );
  36.  
  37.     return (NORMAL);
  38. }
  39.  
  40. int        he386_menu( char *pn )
  41. {
  42.     int        ret;
  43.     char    tmp[256];
  44.     char    *dlg;
  45.     char    *mnu;
  46.     char    *obj;
  47.     char    *p;
  48.  
  49.     if ( pn[0] == '\0' )
  50.         return (NORMAL);
  51.     if ( (p = AMAC_getName(SysMacro,HE386_CCIPATH_KEY)) == NULL )
  52.     {    /* デフォルト    */
  53.         p = AplGetStartPath();
  54.         sprintf( he386_ccipath,"%c:/USR/HE386", *p );
  55.         AMAC_setKey( SysMacro,HE386_CCIPATH_KEY,he386_ccipath);
  56.     } else
  57.     {
  58.         strcpy( he386_ccipath, p );
  59.     }
  60.  
  61.     obj = MNU_alloc(4);
  62.     MNU_setObj(obj, 0, MNU_NOR, 'O', "Option"          , NULL, 1, NULL, NULL);
  63.     MNU_setObj(obj, 1, MNU_NOR, 'P', "CCI Path"        , NULL, 2, NULL, NULL);
  64.     MNU_setObj(obj, 2, MNU_BLK,  0 , NULL              , NULL, 3, NULL, NULL);
  65.     MNU_setObj(obj, 3, MNU_NOR, 'C', "Compile (normal)", NULL, 4, NULL, NULL);
  66.  
  67.     mnu = MNU_open( DLGPOS_MOS_SET_HOME, DLGPOS_MOS_SET_HOME, MNUATT_EXIT,
  68.                                                         obj, "MML Compile" );
  69.  
  70.     LOOP
  71.     {
  72.         ret = MNU_start ( mnu );
  73.         switch ( ret )
  74.         {
  75.             case 1: /* option */
  76.                 dlg = DLG_getsOpen( DLGPOS_MOS_SET_HOME, DLGPOS_MOS_SET_HOME, 320,
  77.                                     "HE386 のオプションパラメータを入力してください。");
  78.                 DLG_getsSetTitle( dlg, "MML Compiler option parameter" );
  79.                 strcpy( tmp, he386_option);
  80.                 ret = DLG_getsStart( dlg, 255, tmp );
  81.                 if ( ret >= 0 )
  82.                     strcpy( he386_option, tmp );
  83.                 DLG_getsClose(dlg);
  84.                 break;
  85.  
  86.             case 2: /* CCI path */
  87.                 dlg = DLG_getsOpen( DLGPOS_MOS_SET_HOME, DLGPOS_MOS_SET_HOME, 320,
  88.                                     "HE386.CCI 格納パス名を入力してください。");
  89.                 DLG_getsSetTitle( dlg, "MML compile cci path" );
  90.                 strcpy( tmp, he386_ccipath);
  91.                 ret = DLG_getsStart( dlg, 255, tmp );
  92.                 if ( ret > 0 )
  93.                 {
  94.                     strcpy( he386_ccipath, tmp );
  95.                     AMAC_setKey( SysMacro,HE386_CCIPATH_KEY,he386_ccipath);
  96.                 }
  97.                 DLG_getsClose(dlg);
  98.                 break;
  99.  
  100.             case 4: /* compile */
  101.                 he386_compile( pn );
  102.                 goto _RET;
  103.             default:
  104.                 goto _RET;
  105.         }
  106.     }
  107.  
  108. _RET:
  109.     MNU_close(mnu);
  110.     MNU_free(obj);
  111.     return (NORMAL);
  112. }
  113.